<!--
 * @Author: your name
 * @Date: 2021-12-22 15:57:58
 * @LastEditTime: 2021-12-22 16:51:02
 * @LastEditors: Please set LastEditors
 * @Description: 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 * @FilePath: \child2-vue\src\views\Home.vue
-->
<template>
  <div class="home">
    {{this.parentData.state.name}}
    <button @click="change">按钮</button>
  </div>
</template>

<script>
// @ is an alias to /src
import { mapState } from 'vuex'
export default {
  name: 'Home',
  components: {
  },
  computed:{
    ...mapState(['parentData'])
  },
  mounted(){
    console.log(this.parentData.state,"ss")
  },
  methods:{
    change(){
      this.parentData.commit("setName","asddazzz")
    }
  }
}
</script>
